﻿using FlightTicketModel;
using System;
using System.Collections.Generic;
using System.Linq;
using System.ServiceModel;
using System.Text;
using System.Threading.Tasks;
using WebServices.Models;
using WebServices.Responses;
using System.ServiceModel.Web;
using WebServices.WebServices.Requests;

namespace FlightTicketContract
{
    /// <summary>
    /// 
    /// </summary>
    [ServiceContract(SessionMode = SessionMode.Allowed)]
    public interface IFlightTicket
    {
        /// <summary>
        /// 添加任务
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [OperationContract]
        [DataContractFormat]
        [WebInvoke(UriTemplate = "FlightTicketTask/AddTask", Method = "POST",
                ResponseFormat = WebMessageFormat.Json, RequestFormat = WebMessageFormat.Json, BodyStyle = WebMessageBodyStyle.Bare)]
        [ServiceKnownType(typeof(ResponseBoolBase))]
        ResponseBoolBase AddTask(FlightTicketTaskRequest request);
        /// <summary>
        /// 添加任务
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [OperationContract]
        [DataContractFormat]
        [WebInvoke(UriTemplate = "FlightTicketTask/UpdateTasksStatus", Method = "POST",
                ResponseFormat = WebMessageFormat.Json, RequestFormat = WebMessageFormat.Json, BodyStyle = WebMessageBodyStyle.Bare)]
        [ServiceKnownType(typeof(ResponseBoolBase))]
        ResponseBoolBase UpdateTasksStatus(RequestStatus request);

        /// <summary>
        /// 添加任务
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [OperationContract]
        [DataContractFormat]
        [WebInvoke(UriTemplate = "FlightTicketTask/UpdateTaskStatus", Method = "POST",
                ResponseFormat = WebMessageFormat.Json, RequestFormat = WebMessageFormat.Json, BodyStyle = WebMessageBodyStyle.Bare)]
        [ServiceKnownType(typeof(ResponseBoolBase))]
        ResponseBoolBase UpdateTaskStatus(long id, FlightTicketModel.TaskStatus status);

        /// <summary>
        /// 分页查询录入的查询任务
        /// </summary>
        /// <param name="req"></param>
        /// <returns></returns>
        [OperationContract]
        [DataContractFormat]
        [WebInvoke(UriTemplate = "FlightTicketTask/GetFlightTicketChildTask", Method = "POST",
                ResponseFormat = WebMessageFormat.Json, RequestFormat = WebMessageFormat.Json, BodyStyle = WebMessageBodyStyle.Bare)]
        [ServiceKnownType(typeof(ResponsePageDataBase<FlightTicketChildTask>))]
        ResponsePageDataBase<FlightTicketChildTask> GetFlightTicketChildTask(FlightTicketTaskRequest req);




        /// <summary>
        /// 分页查询价格结果
        /// </summary>
        /// <param name="list"></param>
        /// <returns></returns>
        [OperationContract]
        [DataContractFormat]
        [WebInvoke(UriTemplate = "PriceModel/AddPriceModel", Method = "POST",
          ResponseFormat = WebMessageFormat.Json, RequestFormat = WebMessageFormat.Json, BodyStyle = WebMessageBodyStyle.Bare)]
        [ServiceKnownType(typeof(ResponseBoolBase))]
        ResponseBoolBase AddPriceModel(List<FlightTicketPrice> list);

        ResponsePageDataBase<FlightTicketPrice> GetFlightTicketPrice(FlightTicketTaskRequest req);

        /// <summary>
        /// 获取爬虫任务
        /// </summary>
        /// <param name="ip"></param>
        /// <param name="count"></param>
        /// <returns></returns>
        [OperationContract]
        [DataContractFormat]
        [WebInvoke(UriTemplate = "FlightTicketTask/GetSpiderTask?ip={ip}&count={count}", Method = "GET",
                ResponseFormat = WebMessageFormat.Json, RequestFormat = WebMessageFormat.Json, BodyStyle = WebMessageBodyStyle.Bare)]
        [ServiceKnownType(typeof(ResponsePageDataBase<FlightTicketChildTask>))]
        ResponsePageDataBase<FlightTicketChildTask> GetSpiderTask(string ip, int count);
        /// <summary>
        /// 获取外网IP
        /// </summary>
        /// <param name="ip"></param>
        /// <param name="count"></param>
        /// <returns></returns>
        [OperationContract]
        [DataContractFormat]
        [WebInvoke(UriTemplate = "Net/IP", Method = "GET",
                ResponseFormat = WebMessageFormat.Json, RequestFormat = WebMessageFormat.Json, BodyStyle = WebMessageBodyStyle.Bare)]
        string NetIP();
        /// <summary>
        /// 获取外网IP
        /// </summary>
        /// <param name="ip"></param>
        /// <param name="count"></param>
        /// <returns></returns>
        [OperationContract]
        [DataContractFormat]
        [WebInvoke(UriTemplate = "Net/PPPOEIP", Method = "GET",
                ResponseFormat = WebMessageFormat.Json, RequestFormat = WebMessageFormat.Json, BodyStyle = WebMessageBodyStyle.Bare)]
        string NetPPPOEIP();

        /// <summary>
        /// 设置封禁IP
        /// </summary>
        /// <param name="ip"></param>
        /// <param name="count"></param>
        /// <returns></returns>
        [OperationContract]
        [DataContractFormat]
        [WebInvoke(UriTemplate = "Net/ForbiddenIP", Method = "POST",
                ResponseFormat = WebMessageFormat.Json, RequestFormat = WebMessageFormat.Json, BodyStyle = WebMessageBodyStyle.Bare)]
        ResponseBoolBase ForbiddenIP(string ip,string domain);


    }
}
